var app = getApp()
Page({
  data: {
    
  },
  onLoad: function (e) {
    var that = this;
    that.requestCardList();
  },
  onShow: function () {
    var that = this;
    app.setNavtitle('会员卡列表');
  },
  requestCardList: function (cid) {
    var that = this;
    var data = {};
    data.map = 'applet_member_card_list';
    app.setVersion(that);
    wx.showLoading({
      title: '加载中',
    })
    wx.request({
      url: app.globalData.requestUrl,
      data: data,
      success: function (res) {
        console.log(res.data);
        if (res.data.ec == 200) {
          that.setData({
            cardList: res.data.data
          })
        } else {
          that.setData({
            cardList: ''
          })
        }
      },
      complete: function () {
        wx.hideLoading();
        wx.stopPullDownRefresh();
      }
    });
  },
  onPullDownRefresh: function () {
    var that = this;
    that.requestCardList();
  },
  tocardDetail:function(e){
    var id = e.currentTarget.dataset.id;
    console.log(id);
    wx.navigateTo({
      url: '/subpages/cardDetail/cardDetail?id='+id
    })
  }
})